package com.sdgakj.enums;

/**
 * Created by win10 on 2017/5/27.
 * 添加亲人选择
 */
public enum EnumPersonType {
    FATHER("0","father"),MOTHER("1","moter"),SON("2","son"),
    DAUGHTER("3","daughter"),BROTHER("4","brother");

    private String code;
    private String name;

    private EnumPersonType(String name, String code) {
        this.name = name;
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static EnumPersonType getEnum(String value){
        for(EnumPersonType e : EnumPersonType.values()){
            if(value.equals(e.getCode())){
                return e;
            }
        }
        return null;
    }
}
